import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_button.dart';

class DeliverForbidBottom extends StatelessWidget {
  final Function()? action;
  const DeliverForbidBottom({
    super.key,
    this.action,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
        color: MGColors.whileColor,
        height: 450,
        padding: EdgeInsets.only(left: 16, right: 16, top: 20, bottom: 20),
        child: Scaffold(
          backgroundColor: MGColors.whileColor,
          body: Column(
            children: [
              Text(
                "禁止投递以下三种快件",
                style: TextStyle(
                  color: MGColors.text1Color,
                  fontWeight: FontWeight.bold,
                  fontSize: MGFont.textFont1,
                ),
              ),
              Container(
                margin: EdgeInsets.only(top: 10, bottom: 20),
                width: double.infinity,
                child: Text(
                  "注 ：一经发现，蜜罐将保留查封账号的权限",
                  style: TextStyle(
                    color: MGColors.themeColor,
                    fontSize: MGFont.textFont2,
                  ),
                ),
              ),
              Flex(
                direction: Axis.horizontal,
                children: [
                  _oneTypeWidget(image: "deliver_oversized", title: "超大件"),
                  SizedBox(width: 20),
                  _oneTypeWidget(image: "deliver_overweight", title: "超重件"),
                  SizedBox(width: 20),
                  _oneTypeWidget(image: "deliver_fresh", title: "生鲜"),
                ],
              )
            ],
          ),
          bottomNavigationBar: MGButton(
            title: "我知道了",
            margin: EdgeInsets.only(left: 40, right: 40, bottom: 20),
            buttonAction: () {
              Get.back();
              if (action != null) {
                action!();
              }
            },
          ),
        ));
  }

  Widget _oneTypeWidget({required String image, required String title}) {
    return Expanded(
        child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Image.asset(MGImage.image(image, type: ImagePathType.deliver)),
        Container(
          margin: EdgeInsets.only(top: 10),
          padding: EdgeInsets.all(12),
          width: double.infinity,
          decoration: BoxDecoration(
            color: MGColors.backColor,
            borderRadius: BorderRadius.circular(6),
          ),
          child: Text(
            title,
            textAlign: TextAlign.center,
            style: TextStyle(
              color: MGColors.text1Color,
              fontSize: MGFont.textFont2,
              fontWeight: FontWeight.bold,
            ),
          ),
        )
      ],
    ));
  }
}
